<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommoditiesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('commodities', function (Blueprint $table) {
            $table->id();
            $table->char('numbering', 10)->unique()->default('')->comment('编号');
            $table->char('name', 64)->index()->default('')->comment('名称');
            $table->integer('category_id')->index()->default(0)->comment('类别');

            $table->integer('supplier_id')->index()->default(0)->comment('供应商');
            $table->integer('offer_price')->default(0)->comment('供价');
            $table->tinyInteger('supply')->default(1)->comment('货源');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('commodities');
    }
}
